package com.learn.mvc.handler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

@Controller
public class LoginHandler1 {
    Logger logger = LoggerFactory.getLogger(this.getClass());
    @RequestMapping("/login")
    public String login(HttpSession session) {
        session.setAttribute("user","111");

        return "portal";
    }

    @RequestMapping(value = "/public/resource/one",produces = "text/html;charset=utf-8")
    @ResponseBody
    public String publicOne() {
        return "未登录1";
    }

    @RequestMapping(value = "/public/resource/two",produces = "text/html;charset=utf-8")
    @ResponseBody
    public String publicTwo() {
        return "未登录2";
    }



    @RequestMapping(value = "/private/resource/one",produces = "text/html;charset=utf-8")
    @ResponseBody
    public String privateOne() {
        return "登录1";
    }

    @RequestMapping(value = "/private/resource/two",produces = "text/html;charset=utf-8")
    @ResponseBody
    public String privateTwo() {
        return "登录2";
    }

    @RequestMapping(value = "/private/resource/threee",produces = "text/html;charset=utf-8")
    @ResponseBody
    public String privateThree() {
        return "登录3";
    }
}
